package 题目集.线段树or树状数组.树状数组;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

/**
 * https://www.acwing.com/problem/content/description/1267/
 * 思路：
 *      先对二维数组按y排序（题目已经排好了），
 *      相当于对每个数，先找出所有y比自己小的（前面已经排好序了），再找所有小于等于当前x的数。
 */
public class ch05_二维偏序 {
    static int maxV = 32010;
    static int[] tree = new int[maxV];
    static int[] level;
    static int n;
    static PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));

    public static void main(String[] args) {
        Reader2 sc = new Reader2();
        n = sc.nextInt();
        level = new int[n];
        int[][] src = new int[n][2];
        for (int i = 0; i < src.length; i++) {
            src[i][0] = sc.nextInt()+1;
            src[i][1] = sc.nextInt()+1;
        }
        for (int i = 0; i < n; i++) {
            int x = src[i][0];
            level[query(x)]++;  //该层++
            add(x, 1);
        }
        for (int i : level) {
            pw.println(i);
        }
        pw.flush();
    }

    private static void add(int i, int v) {
        while (i < tree.length) {
            tree[i] += v;
            i += lowbit(i);
        }
    }


    private static int query(int i) {
        int res = 0;
        while (i > 0) {
            res += tree[i];
            i -= lowbit(i);
        }
        return res;
    }

    private static int lowbit(int x) {
        return x & -x;
    }

    static class Reader2 {
        static StreamTokenizer in = new StreamTokenizer(new BufferedInputStream(System.in));

        public Reader2(Object... o) {
        }

        public int nextInt() {
            try {
                in.nextToken();
            } catch (Exception ignored) {
            }
            return (int) in.nval;
        }
    }

}
